package com.begye.smartloan.apptest.tool

import java.math.BigDecimal
import java.math.RoundingMode

object BigDecimalTool {

    fun divide(num1: String, num2: String): String {
        return try {
            val num1Big = BigDecimal(num1)
            val num2Big = BigDecimal(num2)

            val result = num1Big.divide(num2Big, RoundingMode.HALF_UP)
            result.stripTrailingZeros().toPlainString()

        } catch (e: Exception) {
            //
            "0"
        }
    }
}